<template>
	<view class="agreement">
		<view class="title" v-if="pageType!='新手教程'">{{title}}</view>
		<view v-html="content"></view>
	</view>
</template>

<script>
	import {
		getAgreement
	} from "../../api/index.js"
	export default {
		data() {
			return {
				pageType: '',
				title: '',
				content: '',
			}
		},
		onLoad(opt) {
			this.pageType = opt.pageType
			this.setNavTitle(this.pageType)
			this.onGetAgreement()
		},
		methods: {
			async onGetAgreement() {
				const res = await getAgreement('s=/ApiZwyRequest/agreement')
				const {
					status,
					msg,
					data
				} = res.data
				console.log(res, "res----")
				if (status == 1) {
					switch (true) {
						case this.pageType == '商户入驻申请协议':
							this.title = data.name4
							this.content = data.content4
							break;
						case this.pageType == '用户注册协议' || this.pageType == '平台用户协议':
							this.title = data.name
							this.content = data.content
							break;
						case this.pageType == '隐私政策':
							this.title = data.name2
							this.content = data.content2
							break;
						case this.pageType == '注销重要提醒':
							this.title = data.name5
							this.content = data.content5
							break;
						case this.pageType == '平台规则':
							this.title = data.name3
							this.content = data.content3
							break;
						case this.pageType == '充值协议':
							this.title = data.name6
							this.content = data.content6
							break;
						case this.pageType == '新手教程':
							// this.title = data.name7
							this.content = data.content7
							break;
						case this.pageType == '报单协议':
							this.title = data.name8
							this.content = data.content8
							break;
							case this.pageType == 'VIP协议':
								this.title = data.name9
								this.content = data.content9
								break;

					}

				} else {
					this.showToast(msg)
				}
			},

		}
	}
</script>

<style lang="scss" scoped>
	.agreement {
		text-align: center;
		padding: 30rpx;
	}

	.title {
		margin-bottom: 30rpx;
	}
</style>
